<template>
  <div style="font-size: 12px; line-height: 60px;display: flex" >
    <div style="flex: 1;font-size: 18px">

      <span :class="collapseBtnClass" style="cursor: pointer" @click="collapse"></span>

<!--      <el-breadcrumb separator="/" style="display: inline-block; margin-left: 10px">-->
<!--      <el-breadcrumb-item :to="/manager">首页</el-breadcrumb-item>-->
<!--      <el-breadcrumb-item >{{pathName}}</el-breadcrumb-item>-->
<!--    </el-breadcrumb>-->

    </div>
    <a-dropdown>
      <a class="ant-dropdown-link" @click="e => e.preventDefault()">
        {{admin.nickname}} <a-icon type="down" />
      </a>
      <a-menu slot="overlay">
        <a-menu-item :key="2" @click="logout">退出</a-menu-item>
      </a-menu>
    </a-dropdown>
  </div>
</template>


<script>
  import request from "../utils/request";
  export default {
    name: "Header",
    props:{
      //collapse: Boolean,
      collapseBtnClass: String,
      collapse: {
      },
    },
    data() {
      return {
        admin:{},
      }
    },
    mounted() {
      request.get('/user/getMyInfo').then(res => {
        if (res.code === '200'){
          this.admin = res.data
          if (res.data.username === 'admin'){
            this.$store.state.loginVerifyRole = 'admin'
          }
          else {
            this.$store.state.loginVerifyRole = 'user'
          }
        }
        else
          this.sendWarnMessage('欢迎使用MindFall，请前往登录')
      })
    },
    methods: {
      logout(){
        localStorage.removeItem('mindfall-ticket')
        localStorage.removeItem('_u')
        window.location.href = '/'
      }
    }
  }
</script>

<style scoped>

</style>
